﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.SessionState;

namespace LotteCinema.DAO
{
    public class KetNoiCSDL
    {
        public static string ChuoiKetNoi = //"workstation id=dientugiadung.mssql.somee.com;packet size=4096;user id=nhutphuongit_SQLLogin_1;pwd=2fw7frhcdv;data source=dientugiadung.mssql.somee.com;persist security info=False;initial catalog=dientugiadung";
            System.Configuration.ConfigurationManager.ConnectionStrings[DAO.global.tendatabase].ConnectionString.ToString();

        public static SqlConnection KetNoi;
        public KetNoiCSDL()
        {
            if (KetNoi == null)
            {
                KetNoi = new SqlConnection(ChuoiKetNoi);
            }
        }
        public SqlConnection LayKetNoi()
        {
            if (KetNoi.State == ConnectionState.Closed)
            {
                KetNoi.Open();
                return KetNoi;
            }
            else
                return KetNoi;
        }
    }
}
